package com.example.controller.msg;

import com.alibaba.fastjson.JSONObject;
import com.example.ribbon.service.ReceiveMsgRecordRibbonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/receive/record")
public class ReceiveMsgRecordController {

    @Autowired
    private ReceiveMsgRecordRibbonService receiveMsgRecordRibbonService;

    @GetMapping("/getmsglist")
    public JSONObject getMsgList(){
        return receiveMsgRecordRibbonService.getUserMsgRecordList();
    }

    @GetMapping("/getmsgpage")
    public JSONObject getMsgPage(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                                 @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize){
        return receiveMsgRecordRibbonService.getUserMsgRecordPage(pageNum,pageSize);
    }

    @GetMapping("/getmsgpage/touid")
    public JSONObject getMsgPage(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
                                 @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                                 @RequestParam(value = "toUid")String toUid){
        return receiveMsgRecordRibbonService.getUserMsgRecordPage(pageNum,pageSize,toUid);
    }
}
